package servlet;

import dao.UsersDao;
import vo.User;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 * Created by ssw on 2018/6/19.
 */
public class AskStuInfoServlet extends HttpServlet{
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        HttpSession httpSession=req.getSession();
        HttpSession session=req.getSession();
        User users= (User) session.getAttribute("user");
        UsersDao usersDao=new UsersDao();
        User userInfo=usersDao.askStuInfo(users.getUid());
        req.setAttribute("userInfo",userInfo);
        if(req.getParameter("from")!=null&&req.getParameter("from").equals("lec_queryInfo"))
            req.getRequestDispatcher("sgms/lec_queryInfo.jsp").forward(req,resp);
        else
            req.getRequestDispatcher("sgms/user_queryInfo.jsp").forward(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }
}
